

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link href="/ssm/consumer/css/style.css" rel='stylesheet' type='text/css' />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!--webfonts-->
		<!--//webfonts-->
	</head>

	<body>
		<div class="main" align="center">
			<div class="header">
				<h1>会员注册</h1>
			</div>
			<p></p>
			<form method="post" action="">
				<input type="hidden" name="op" value="regist" />
				<ul class="left-form">
					<li>
						<input type="text" id="username" placeholder="用户名" required="required"/>
						<a href="#" class="icon ticker"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="text" id="cellphone" placeholder="手机号" required="required"/>
						<a href="#" class="icon ticker"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="text" id="email" placeholder="邮箱" required="required"/>
						<a href="#" class="icon ticker"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="text" id="address" placeholder="联系地址" required="required"/>
						<a href="#" class="icon ticker"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="text" id="nickname" placeholder="昵称" required="required"/>
						<a href="#" class="icon ticker"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="password" id="password" placeholder="密码" required="required"/>
						<a href="#" class="icon into"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="password" id="repassword" placeholder="确认密码" required="required"/>
						<a href="#" class="icon into"> </a>
						<div class="clear"> </div>
					</li>
					<li>
						<input type="submit" id="submitReg" value="创建账户">
						<div class="clear"> </div>
					</li>
					<li>
						已有账号？<a href="/ssm/consumer/login.html" style="color: green;">立即登录</a>
					</li>
			</ul>

			<div class="clear"> </div>

			</form>

		</div>
		<!-----start-copyright---->

		<!-----//end-copyright---->
		<script type="text/javascript" src="/ssm/consumer/js/jquery.min.js"></script>
		<script type="text/javascript">
		$("#submitReg").click(function(){
			   var username = $("#username").val();
			   var cellphone = $("#cellphone").val();
			   var real_name = $("#nickname").val();
			   var address = $("#address").val();
			   var password = $("#password").val();
			   var repassword = $("#repassword").val();
			   var email = $("#email").val();
			   if(username&&cellphone&&password&&repassword&&email){
			   		var qUrl="/ssm/consumer/register.do";
					 if(cellphone.length!=11){
						 alert("手机号格式不正确");
						 return false;
					 }
					 var postData = {
							 	email:email,
				                username : username,
				                password : password,
				                real_name : real_name,
				                cellphone :cellphone ,
				                address : address
				            };
					 	
			            $.post(qUrl,postData,function(res){
			             if(res.code=="01"){
			                 alert("注册成功");
			                 //刷新父页面
			                 location.href="/ssm/consumer/login.html";
			             }else{
			            	 alert(res.body);
			             }
		            })
						 
				   
			   }else{
					alert("请填写完整");		   
			   }
			   return false;
		   })
		   
		   function sendCode(){
				var cellphone = $("#cellphone").val();
				if(!cellphone){
	                 alert("请输入手机号");
	                 return;
	             }
				$("#sendBtn").hide();
				$("#timer").show();
				settime();
				var postData = {
						mobile:cellphone,
				}
				$.post('/ssm/sendCheckCode.do',postData,function(){
					
				}) 
			
			}
		
			var countdown = 60;
			function settime() {
			    if (countdown == 0) {
			    	$("#timer").hide();
			    	$("#sendBtn").show();
			        countdown = 60;
			        return;
			    } else {
			        countdown--;
			        $("#timer").text(countdown);
			    }
			setTimeout(function() {
			    settime() }
			    ,1000)
			}
		
		</script>
	</body>
	
</html>